package tr.edu.yildiz.util;

/**
 * Characters and alphabetical order num matchings.
 * 
 * @author Onur Ulusu
 * 
 */
public class CharUtils {
	private static String alphabet = "abcdefghijklmnopqrstuvwxyz";

	/**
	 * Finds alphabetical order num of given character.
	 * 
	 * @param input
	 *            character
	 * @return alphabetical order num of given character.
	 */
	public static int getNumericSeqOfChar(char input) {
		int i;
		for (i = 0; i < alphabet.length(); i++) {
			if (alphabet.charAt(i) == input) {
				break;
			}
		}
		return i;
	}

	/**
	 * Finds character of given alphabetical order num.
	 * 
	 * @param input
	 *            alphabetical order num.
	 * @return character in given alphabetical order num.
	 */
	public static char getCharofGivenSeq(int input) {
		return alphabet.charAt(input);
	}
}
